package com.heima.tlias.controller;

import com.heima.tlias.controller.response.JobOptionVo;
import com.heima.tlias.service.ReportService;
import com.heima.tlias.utils.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping(path = "/report")
@RequiredArgsConstructor
public class ReportController {

    private final ReportService reportService;

    /**
     * 查询员工职位数量统计信息
     *
     * @return
     */
    @GetMapping(path = "/empJobData")
    public Result<JobOptionVo> queryEmpJobData() {
        JobOptionVo jobOptionVo = reportService.queryEmpJobData();
        return Result.success(jobOptionVo);
    }

    /**
     * 查询员工性别统计数据
     *
     * @return
     */
    @GetMapping(path = "/empGenderData")
    public Result<List<Map<String, Object>>> queryEmpGenderData() {
        List<Map<String, Object>> empGenderData = reportService.queryEmpGenderData();
        return Result.success(empGenderData);
    }


    /**
     * 班级人数统计
     *
     * @return
     */
    @GetMapping(path = "/studentCountData")
    public Result<Map<String, List<Object>>> studentCountData() {
        Map<String, List<Object>> data = reportService.studentCountData();
        return Result.success(data);
    }

    /**
     * 学员学历统计
     *
     * @return
     */
    @GetMapping(path = "/studentDegreeData")
    public Result<List<Map<String, Object>>> studentDegreeData() {
        List<Map<String, Object>> data = reportService.studentDegreeData();
        return Result.success(data);
    }
}
